﻿using System;
using System.Collections.Generic;
using System.ComponentModel; 

 
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

using System.Runtime.InteropServices;
using Microsoft.Win32;

using System.Diagnostics;
using System.IO;


namespace VirtualDrive
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        [DllImport("user32.dll", SetLastError = true)]
        private static extern long SetParent(IntPtr hWndChild, IntPtr hWndNewParent);

        [DllImport("user32.dll", EntryPoint = "SetWindowLongA", SetLastError = true)]
        private static extern long SetWindowLong(IntPtr hwnd, int nIndex, long dwNewLong);


        private const int GWL_STYLE = (-16);
        private const int WS_VISIBLE = 0x10000000;

        private void pictureBox2_Click(object sender, EventArgs e)
        {

        }
        private void panel1_DragEnter(object sender, DragEventArgs e)
        {
            e.Effect = DragDropEffects.None;
            string[] FilesX = (string[])e.Data.GetData(DataFormats.FileDrop);
            bool CanDrop = true;
            Task Verify = new Task(() =>
            {
                foreach (String file in FilesX.Where(x => !x.ToLowerInvariant().EndsWith(".vrb")))
                {

                    CanDrop = false;
                }
            }); Verify.Start(); Verify.Wait();

            if (Verify.IsCompleted && CanDrop == true)
            {
                e.Effect = DragDropEffects.Copy;

            }
             
           
        
        }

        private void panel1_DragDrop(object sender, DragEventArgs e)
        {
            VirtualFolder _Create = new VirtualFolder();
            _Create.VFiles = (string[])e.Data.GetData(DataFormats.FileDrop);
            _Create.Show();
            this.Hide();

           
        }
       

    }
}
